package com.um.jdy.app.user.manager;

import cn.hutool.core.bean.BeanUtil;
import com.um.jdy.app.user.entity.dto.*;
import com.um.jdy.common.member.entity.po.MemberUser;
import com.um.jdy.common.member.entity.vo.MemberUserVO;
import com.um.jdy.common.member.service.MemberUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title
 * @Description
 * @Author renjunwei
 * @Date 2023/5/22 10:37
 */
@Slf4j
@Service
public class UserManager {

    @Autowired
    MemberUserService userService;

    /**
     * 获取登陆用户信息
     * @return
     */
    public MemberUserVO get(){
        return BeanUtil.toBean(userService.get(), MemberUserVO.class);
    }

    /**
     * 获取登陆用户信息
     * @return
     */
    public void edit(EditUserParam param){
        MemberUser user = userService.get();
        BeanUtil.copyProperties(param, user);
        userService.save(user);
    }

}
